package hotel;

import java.util.Scanner;

public class jiudian {
String name;
Room[][] rooms ;
public jiudian() {
	name = "指针信息大酒店";
	rooms = new Room[6][8];
	for (int i = 0;i < rooms.length;i ++) {/*i表示每层楼*/
		for(int j = 0;j < rooms[i].length;j ++) {/*j表示一层楼里的房间数*/
			int number = (i + 1) * 100 + j + 1;
			rooms[i][j] = new Room(number);
		}
	}
}
public void show() {
	for (int i = 0;i < rooms.length;i ++) {/*i表示每层楼*/
		for(int j = 0;j < rooms[i].length;j ++) {/*j表示一层楼里的房间数*/
        System.out.print(rooms[i][j].number + "\t");
		}
        System.out.println();
	for (int j = 0;j < rooms[i].length;j ++) {
		if(rooms[i][j].guest != null) {
	        System.out.print(rooms[i][j].guest.name + "\t");
		}else {
	        System.out.print(null + "\t" );
		}       
	}
    System.out.println();
	}
}
public void in() {
    System.out.println("请输入要入住的房间号");
    Scanner console1 = new Scanner(System.in);
	int num = console1.nextInt();
	int a = num / 100;
	int b = num % 100;
			if(rooms[a-1][b-1].guest != null) {
				System.out.println("非常抱歉，这他妈有人住了");
		}else {
		    System.out.println("请输入你的名字");
		    Scanner console2 = new Scanner(System.in);
			String name = console2.nextLine();
			rooms[a-1][b-1].guest = new Guest(name) ;
			System.out.println("入住成功");
		}
}
public void out() {
    System.out.println("请输入要退房的房间号");
    Scanner console1 = new Scanner(System.in);
	int num = console1.nextInt();
	int a = num / 100;
	int b = num % 100;
			if(rooms[a-1][b-1].guest == null) {
				System.out.println("你妈的这里面没有人住");
		}else {
			rooms[a-1][b-1].guest = null ;
			System.out.println("退房成功");
		}
}
}